package com.file;

import java.io.File;
import java.io.IOException;
import java.util.Random;

public class FileDemo {
    public static void main(String[] args) {
        //创建file对象
       //File file1 = new File("d:\\imooc\\io\\score.txt");
       //File file1 = new File("d:\\imooc","io\\score.txt");
        File file = new File("d:\\imooc");
        File file1 = new File(file,"io\\score.txt");
        boolean n = file1.isDirectory();
        System.out.println(n);
        //创建文件
        File file2  = new File("d:\\imooc\\set\\HashSet");
        if(!file2.exists()){
            file2.mkdirs();
        }

        //创建文件
        if(!file1.exists()){
            try {
                file1.createNewFile();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        File f = new File("d:\\imooc\\java\\thread\\thread.txt");
        System.out.println(f.exists());

    }
}
